package cn.edu.dlmu.cogo.register;

import cn.edu.dlmu.cogo.framework.context.ApplicationContextAware;
import cn.edu.dlmu.cogo.framework.context.Environment;
import cn.edu.dlmu.cogo.framework.context.ExcludeClass;
import cn.edu.dlmu.cogo.framework.utils.CogoClassUtil;
import cn.edu.dlmu.cogo.framework.web.CogoWebServerAware;
import cn.hutool.core.lang.Console;

/**
 * @author hongda.li@hand-china.com 2022/3/11 10:42
 */
public class ExcludeCogoWeb implements ExcludeClass {

    @Override
    public Class<? extends ApplicationContextAware> exclude() {
        if (CogoClassUtil.mainClassWithAnnotation(EnableRegisterServer.class)) {
            Console.log("{} [CogoRegister]移除cogo-framework中提供的默认Web容器实现：CogoWebServerAware", Environment.getSystemTime());
            Console.log("{} [CogoRegister]新增cogo-with-register中提供的Web容器实现：RegisterWebAware", Environment.getSystemTime());
            return CogoWebServerAware.class;
        }else {
            return RegisterServerAware.class;
        }
    }
}
